package com.dhcc.bpm.modules.scf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dhcc.bpm.modules.scf.dto.ScfRenewableInInfoDTO;
import com.dhcc.bpm.modules.scf.entity.ScfRenewableInInfo;
import com.dhcc.bpm.modules.scf.entity.SelectEntity.RenewableInByPayment;
import com.dhcc.bpm.modules.scf.vo.ScfRenewableInInfoVO.ScfGetRenewableInDetailsVO;
import com.dhcc.bpm.modules.scf.vo.ScfRenewableInInfoVO.ScfGetRenewableInListVO;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;

/**
 *  再生资源入库-Mapper接口
 */
@Repository
public interface ScfRenewableInInfoMapper extends BaseMapper<ScfRenewableInInfo> {

    /**
     * 自定义分页
     *
     * @param page
     * @param scfRenewableInInfo
     * @return
     */
    List<ScfGetRenewableInListVO> selectScfRenewableInInfoPage1(IPage<ScfGetRenewableInListVO> page, ScfRenewableInInfoDTO scfRenewableInInfo);

    /**
     * 查询未被关联的记录分页列表
     *
     * @return
     */
    List<ScfGetRenewableInListVO> selectUnrelatedRecords(IPage<ScfGetRenewableInListVO> page, ScfRenewableInInfoDTO scfRenewableInInfo);

    /**
     * 自定义查询详情
     *
     * @param
     * @return
     */
    ScfGetRenewableInDetailsVO getDetails(String rowId);

    /**
     * 根据再生入库单号啊查询再生入库单编号rowId
     *
     * @param renewableInNum
     * @return
     */
    String selectRowIdByRenewableInNum(String renewableInNum);


    /**
     * 再生入库关联支付回单关系保存
     *
     * @return
     */
    int saveRenewableInByPayment(String rowId, String renewableInNum, String renewableRowId, String paymentNum, String paymentRowId, BigDecimal useAmount ,String orgCode);

    /**
     * 根据再生入库单号删除再生入库与支付回单关联关系表中的记录
     *
     * @param renewableInNum
     * @return
     */
    int deleteRenewableInByPayment(String renewableInNum);

    /**
     * 查询再生入库单与支付回单的关联关系
     *
     * @param renewableInNum
     * @return
     */
    List<RenewableInByPayment> selectRenewableInByPayment(String renewableInNum);


    boolean deleteByIds(String[] ids);
    boolean deleteSalesByIds(String[] ids);



    int saveBatchRenewableInList(@Param("scfRenewableInInfoList") List<ScfRenewableInInfo> scfRenewableInInfoList);
}
